
public class Thing
{
    private String name;
    private int energy;
    
    public Thing(String name,int energy){/*构造函数*/
        this.name = name;
        this.energy = energy;
    }
    
    public int getEnergy(){
        return this.energy;
    }
    
    public String getName(){
        return this.name;
    }
    public String toString(){//会自动调用此方法
        return "名称:" + this.name + ",能量:" + this.energy;
    }
}
